home *** CD-ROM | disk | FTP | other *** search
/ Best of Shareware / Best of PC Windows Shareware 1.0 - Wayzata Technology (7111) (1993).iso / mac / DOS / UTILITY / MXMNU238 / LOGIN.MNU < prev    next >
Text File  |  1992-03-13  |  22KB  |  919 lines

  1. Comment
  2. ========================================================
  3.  
  4. Copyright 1990-92 by Marc Perkel * All right reserved.
  5.  
  6. MarxMenu now allows you to login to a Novell network without using
  7. Novell's login program or messing with nasty login scripts. You can
  8. be in MarxMenu all the way in.
  9.  
  10. Before you start on this make sure you have read the Novell section of
  11. the MarxMenu manual. This menu is somewhat tricky and requires some
  12. study before you dive right in.
  13.  
  14. Logging into Novell is tricky. Especially if you are using boot roms
  15. on your network cards. Through much trial and error, I have found
  16. some solid tricks that make life easier.
  17.  
  18. You should have the following two BATCH files in your LOGIN
  19. directory as follows:
  20.  
  21. LOADNET.BAT  ;if used with BESTNET
  22. -----------
  23. @Echo Off
  24. %NET%
  25. %NETD%
  26. Set NET=
  27. Set NETD=
  28. Startup
  29.  
  30. LOADNET.BAT  ;if not used with BESTNET
  31. -----------
  32. @Echo Off
  33. NETX
  34. F:
  35. Startup
  36.  
  37. STARTUP.BAT
  38. -----------
  39. SET BOOTUP=LOGIN
  40. MarxMenu Login
  41. %BOOTUP%
  42.  
  43. Each workstation should have their own AUTOEXEC.BAT. The last line
  44. should be LOADNET. If you are running multiple versions of dos or a
  45. variety of computers you should run BESTNET as part of your bootup
  46. sequence.
  47.  
  48. Also, if you want automatic login you can add the following lines to you
  49. AUTOEXEC.BAT file:
  50.  
  51. SET USERNAME=MARC   Your Name Here
  52. SET PASSWORD=NERD   Your Password Here
  53.  
  54. You should also change the COMSPEC= to the network command.com BEFORE
  55. you run NETX. For some unknown reason, this solves a lot of problems.
  56.  
  57. Example:
  58.  
  59. IPX
  60. SET COMSPEC=O:COMMAMD.COM
  61. NETX
  62.  
  63. Another boot rom quirk is that you can't run any program off a boot
  64. rom that trashes upper memory. An example is running QEMM on a
  65. monochrome monitor.
  66.  
  67. By using this method the boot disk or boot rom hands control over in
  68. a clean way. LOADNET.BAT then branches to STARTUP.BAT for the rest
  69. of the login sequence.
  70.  
  71. For some strange reason which I can't explain, LOADNET and STARTUP
  72. have to be two separate batch files. I think it forces the transient
  73. part of COMMAND.COM to load into memory. Anyhow, don't combine these
  74. into one batch file
  75.  
  76. The first line of STARTUP.BAT is a message that tells this menu that
  77. the user is logging in for the first time. This menu creates a batch
  78. file and puts the name of it in the environment variable BOOTUP.
  79. STARTUP.BAT then executes this file.
  80.  
  81. This is the example for MY network. You'll have to modify it for
  82. yours. I'm doing a lot of tricky things in my login. Your login might
  83. not need to be as complex as mine.
  84.  
  85. One word of caution. After modifing this menu, always run MARXCOMP
  86. LOGIN to compile it. Otherwise, if you boot up into it you won't
  87. have enough access rights to recompile automatically. I do this by
  88. making a file called L.BAT.
  89.  
  90. ME LOGIN.MNU
  91. MARXCOMP LOGIN.MNU
  92.  
  93. ========================================================
  94. EndComment
  95.  
  96. var
  97.    UserName
  98.    OldPass
  99.    NewPass
  100.    Logged
  101.    Station
  102.    NetAddress
  103.    SmartDir
  104.    MyServer
  105.    OrigServer
  106.    HomeDir
  107.    DosDir
  108.    UseMarxLogin
  109.    Shell
  110.    PasswordExpDays
  111.    SkipError
  112.    Servers
  113.    StatusWin
  114.    TsrLoaded
  115.    DrDos6
  116.    MyGroups
  117.  
  118. Comment
  119. ========================================================
  120.  
  121. If UseMarxLogin is set to true then this program will use the MarxMenu
  122. API call to log into the network. If set to false the it will shell
  123. Novell's LOGIN.EXE program.
  124.  
  125. If UseMarxLogin is set to true, and you are using 386 NetWare then you
  126. will have to add the following command to your AUTOEXEC.NCF file:
  127.  
  128. SET ALLOW UNENCRYPTED PASSWORDS = ON
  129.  
  130. ========================================================
  131. EndComment
  132.  
  133. UseMarxLogin = True
  134.  
  135. Shell = CleanFileName(ReadEnv('COMSPEC'))
  136. MyServer = NovDefaultServer
  137. OrigServer = MyServer
  138. NovServers(Servers)
  139. Logged = ReadEnv('LOGGED') = 'TRUE'
  140.  
  141. SkipError = False
  142.  
  143. TryAutoLogin
  144. if not Logged then LoginFromScreen
  145.  
  146. NovSetPrimaryServer (MyServer)
  147. NovSetPreferredServer (MyServer)
  148.  
  149. NovReadGroups(UserName,MyGroups)    ;Read Groups user is in.
  150. SortArray(MyGroups)
  151.  
  152. UserName = NovMyLoginName
  153. SetEnv ('LOGGED=')
  154. SetEnv ('USERNAME=' + UserName)
  155. SetEnv ('PASSWORD=')
  156.  
  157. ;----- Another Server Selected
  158.  
  159. if MyServer <> OrigServer
  160.    SetEnv ('BOOTUP=STARTUP')
  161.    SetEnv ('LOGGED=TRUE')
  162.    NovMapDrive('F',MyServer + '/SYS:LOGIN')
  163.    ChDir('F:\LOGIN')
  164.    ExitMenu
  165. endif
  166.  
  167. ;----- You can't assume that you have an F: drive unless you map it.
  168.  
  169. NovMapDrive ('F','SYS:\LOGIN')
  170.  
  171. Comment
  172. ========================================================
  173.  
  174. If a TEMP environment variable is set, MarxMenu will use it for
  175. temporary batch files. This is compatible with DOS 5 and Windows
  176. conventions. The users should be given full access rights to this
  177. directory. I'm using \TMPFILES for my network.
  178.  
  179. ========================================================
  180. EndComment
  181.  
  182. if ExistDir('F:\TMPFILES') then SetEnv('TEMP=F:\TMPFILES')
  183.  
  184. ;----- Here we calculate a home directory for each user.
  185.  
  186. HomeDir = 'F:\HOME\' + UserName
  187. if UserName = 'SUPERVISOR' then HomeDir = 'F:\SYSTEM'
  188. if not ExistDir(HomeDir) then HomeDir = 'F:\PUBLIC\UTIL'
  189.  
  190. Comment
  191. ========================================================
  192.  
  193. Here we calulate the the name of the dos directory that matches the
  194. version of dos we are running. The directory for DOS 5.0 would be
  195. F:\PUBLIC\DOSV5.00
  196.  
  197. ========================================================
  198. EndComment
  199.  
  200. DosDir = 'F:\PUBLIC\DOSV' + DosVersionString
  201.  
  202. ;----- DR DOS (NovOS)
  203.  
  204. if ReadEnv('OS') > ''
  205.    DosDir = 'F:\PUBLIC\' + ReadEnv('OS') + ReadEnv('VER')
  206.    DrDos6 = Value(ReadEnv('VER')) >= 6
  207.    if DrDos6
  208.       Bat('SHARE')
  209.    endif
  210. endif
  211.  
  212. Comment
  213. ========================================================
  214.  
  215. Here's where we map our drives. This does not set the search path.
  216. You set that explicitly by writing to the PATH environment variable.
  217.  
  218. Drive map commands may contain server and volume referrences:
  219.  
  220. ========================================================
  221. EndComment
  222.  
  223. NovMapRoot ('H', HomeDir)           ;Home Directory
  224. NovMapRoot ('N','F:\PUBLIC\NSK')    ;Network Survival Kit
  225. NovMapRoot ('O', DosDir)            ;Dos Directory
  226. NovMapRoot ('U','F:\PUBLIC\UTIL')   ;Utilities Directory
  227. NovMapRoot ('P','F:\PUBLIC')        ;Public Directory
  228. NovMapRoot ('L','F:\LOGIN')         ;Login Directory
  229.  
  230. Comment
  231. ========================================================
  232.  
  233. Here we set a different directory for a program depending on if we
  234. have a color or monochrome monitor.
  235.  
  236. ========================================================
  237. EndComment
  238.  
  239. if VideoMode = Mono
  240.    SmartDir = 'F:\PUBLIC\MSMART'
  241. else
  242.    SmartDir = 'F:\PUBLIC\CSMART'
  243. endif
  244.  
  245. if ExistDir SmartDir
  246.    NovMapRoot ('S',SmartDir)
  247. endif
  248.  
  249. Comment
  250. ========================================================
  251.  
  252. W: is a work drive. When an application needs an extra search path, I
  253. move W: to that directory.
  254.  
  255.  OnKey 'L'
  256.    |NovMapRoot('W','\PUBLIC\LOTUS')
  257.    Lotus
  258.  
  259. ========================================================
  260. EndComment
  261.  
  262. NovMapRoot('W','H:')
  263.  
  264. if NovConsoleOperator
  265.    NovMapRoot ('V','F:\SYSTEM')     ;System Directory
  266. endif
  267.  
  268. if MyServer = 'TYME'
  269.    NovMapDrive ('I','VOL1:')
  270.  
  271.    ;----- Here's where I log into a second server.
  272.  
  273.    if PosInList('TYME2',Servers) > 0
  274.       NovLogin('TYME2/' + UserName,OldPass)
  275.       NovMapDrive('K','TYME2/SYS:')
  276.    endif
  277.  
  278.    ;----- Here's where I log into a third server.
  279.  
  280.    if PosInList('TSS',Servers) > 0
  281.       NovLogin('TSS/' + UserName,OldPass)
  282.       NovMapDrive('J','TSS/SYS:')
  283.    endif
  284.  
  285.    ;----- Here's where I log into another server.
  286.  
  287.    if PosInList('MARX',Servers) > 0
  288.       NovLogin('MARX/' + UserName,OldPass)
  289.       NovMapDrive('G','MARX/SYS:')
  290.    endif
  291.  
  292. endif
  293.  
  294. ;----- Turbo Pascal 6
  295.  
  296. if ExistDir ('H:\TP6') then NovMapRoot ('T','H:\TP6')
  297.  
  298. ;----- If no drive C then use home directory
  299.  
  300. if Floppies < 3                     ;I'm using some 4 floppy machines
  301.    if not ExistDir ('C:\') then NovMapRoot('C','H:')
  302. endif
  303.  
  304. ;----- Here we define our search paths.
  305.  
  306. SetEnv ('PATH=T:\;H:\;W:\;U:\;N:\;O:\;P:\;V:\;S:\;')
  307.  
  308. FixPath    ;Verifies all search paths exist
  309.  
  310. ChDir (HomeDir)
  311.  
  312. ;----- Here's where we set master environment variable strings
  313.  
  314. SetEnv ('STATION=' + Station)
  315. if Left(Shell,2) <> 'C:' then SetEnv ('COMSPEC=O:\COMMAND.COM')
  316. SetEnv ('PROMPT=$e[1;33m$p: $e[0;32m')  ;ansi required
  317. SetEnv ('MXECHO=OFF')
  318.  
  319. ;----- Check for personal menu.
  320.  
  321. if ExistFile('H:\' + UserName + '.MNU')
  322.    SetEnv('PMENU=' + UserName + '.MNU')
  323. endif
  324.  
  325. ;----- Here's where I set up for Pick Directory
  326.  
  327. if UserName <> 'MARC'
  328.    SetEnv ('PD.EXE=/$F:\HOME\PD.PIC')
  329. else
  330.    SetEnv ('PD.EXE=/$H:\PD.PIC')
  331. endif
  332.  
  333. Comment
  334. ========================================================
  335.  
  336. Opens a semaphore that XMETER can read.
  337. To see how many users are users are on with XMETER type:
  338. XMETER LOGIN /U
  339.  
  340. ========================================================
  341. EndComment
  342.  
  343. NovOpenSemaphore ('XM-LOGIN',0)
  344.  
  345. ;----- Turn NumLock key on if in NumLock group.
  346.  
  347. if InGroup('NUMLOCK')
  348.    NumLock On
  349. else
  350.    NumLock Off
  351. endif
  352.  
  353. ;----- LOGIN is set to BOOTUP if logging in for the first time
  354.  
  355. if UpperCase(ReadEnv('BOOTUP')) <> 'LOGN' then ExitMenu
  356.  
  357. Comment
  358. ========================================================
  359.  
  360. In order to load TSRs, MarxMenu writes a temporary batch file and
  361. exits. The STARTUP.BAT file then jumps to this batch file.
  362.  
  363. ========================================================
  364. EndComment
  365.  
  366. ;----- Create temporary batch file for rest of login sequence
  367.  
  368. SetEnv ('BOOTUP=' + BatFileName)
  369.  
  370. ;----- To debug, set ECHO ON and add PAUSE commands
  371.  
  372. if DosVersionString < '3.30'
  373.    Bat('ECHO OFF')
  374. else
  375.    Bat('@ECHO OFF')
  376. endif
  377.  
  378. Bat ('SET BOOTUP=')     ;clear BOOTUP environment variable
  379.  
  380. ;----- Set BREAK to ON if NovConsoleOperator
  381.  
  382. if NovConsoleOperator then Bat('BREAK ON')
  383.  
  384. Comment
  385. ========================================================
  386.  
  387. Here's where we load up all the TSRs the user is going to use. We set
  388. the environment variable TSR to Y to indicate that TSRs are loaded. This
  389. way if we log out and then back in we won't load them twice.
  390.  
  391. ========================================================
  392. EndComment
  393.  
  394. TsrLoaded = ReadEnv('TSR') = 'Y'
  395.  
  396. if not TsrLoaded
  397.  
  398.    SetEnv ('TSR=Y')
  399.  
  400.    ;----- Load CastAway
  401.  
  402.    if InGroup ('CASTAWAY')
  403.       Bat ('P:\EXPR\CASTAWAY N /W=0 /I=0 /H')
  404.    endif
  405.  
  406.    ;----- Load ExpressIT Mail System
  407.  
  408.    if InGroup ('EXPRESSIT')
  409.       Bat ('P:\EXPR\EXPRESS F12')
  410.    endif
  411.  
  412.    ;----- Load Lan Assist
  413.  
  414.    if InGroup ('LANASSIST')
  415.       if InGroup ('LA-RES')
  416.          Bat (LoadHigh + 'P:LA\LA /L >NUL')
  417.       else
  418.          Bat (LoadHigh + 'P:LA\LA +N >NUL')
  419.       endif
  420.    endif
  421.  
  422.    ;----- Load SideKick if in Sidekick Group
  423.  
  424.    if InGroup('SIDEKICK')
  425.       Bat ('KBD CR')
  426.       Bat (LoadHigh + 'SWAPSK/N/G/D' + HomeDir + ' >NUL')
  427.       Bat ('SK')
  428.       Bat ('CLS')
  429.    endif
  430.  
  431.    ;----- Load SideKick 2 if in SK2 Group
  432.  
  433.    if (InGroup('SK2')) and not DrDos6
  434.       Bat (LoadHigh + 'P:\SK2\SK2')
  435.    endif
  436.  
  437.    ;----- Dr Dos 6
  438.  
  439.    if DrDos6
  440.       Bat('TaskMax')
  441.    endif
  442.  
  443.    ;----- Load MarxPop
  444.  
  445.    if InGroup('MARXPOP') and not DrDos6
  446.       Bat('MarxPop H:MarxPop.cfg')
  447.    endif
  448.  
  449. endif
  450.  
  451. Capture('LASER',2)
  452.  
  453. Comment
  454. ================================================================
  455.  
  456. This next section deals with running special programs bases on the
  457. physical station number rather than by user. This deals with special
  458. hardware that needs software drivers loaded.
  459.  
  460. ================================================================
  461. EndComment
  462.  
  463. ;----- CD ROM Machine
  464.  
  465. ;if NetAddress = '255:2'
  466. ;   Bat ('CD\PUBLIC\MA')
  467. ;   Bat ('MSCDEX.EXE /D:MSCD003 /M:12')
  468. ;   Bat ('MAR C:\ RW=/ /C')
  469. ;endif
  470.  
  471. ;if (NetAddress = '255:C3') or (NetAddress = '254:C3')
  472. ;   Bat('MODE BW80')
  473. ;endif
  474.  
  475. ;----- Set Keyboard Speed Faster if 286 or greater.
  476.  
  477. if CPUClass > 1 then Bat('KBD 6')
  478.  
  479. Comment
  480. ================================================================
  481.  
  482. This next section deals with running special programs bases on the
  483. users preferrences.
  484.  
  485. ================================================================
  486. EndComment
  487.  
  488. if UserName = 'MARC'
  489.    Capture('DOT',1)
  490.    ChDir('TP6')
  491. endif
  492.  
  493. if UserName = 'VICKI'
  494. ;   if not TsrLoaded then Bat(LoadHigh + 'MOUSE')
  495. endif
  496.  
  497. if UserName = 'KEVIN'
  498.    Capture('DOT',2)
  499.    SetEnv('PROMPT=($p)')
  500.    SetEnv('PATH=' + ReadEnv( 'Path' ) + ';f:\home\kevin\brief' )
  501.    ChDir('MARX')
  502. endif
  503.  
  504. if UserName = '386'
  505.    Capture('DOT',1)
  506. endif
  507.  
  508. if UserName = 'TBBS'
  509.    Capture('DOT',1)
  510.    ChDir('I:\BBS\TBBS')
  511.    NovMapDrive('H','I:')
  512.    SetEnv('D.EXE=/O/I')
  513.    Bat('CASTOFF')
  514.    Bat('DROPTO R1')
  515. endif
  516.  
  517. if UserName = 'GRACE'
  518.    Bat('KBD 6 NumOn');
  519. endif
  520.  
  521. if UserName = 'WORK'
  522.    Capture('DOT',1)
  523. endif
  524.  
  525. if UserName = 'LITE'
  526.    Capture('DOT',1)
  527.    NovMapRoot('W','P:\INTEL')
  528.    Bat(LoadHigh + 'W:CASMGR.EXE W:CASMGR.CFG')
  529.    Bat(LoadHigh + 'W:FAXPOP.EXE')
  530.    ChDir('F:\PUBLIC\INTEL')
  531.    if AfterHours
  532.       BAT('CD\PUBLIC\AWHOST')
  533.       BAT('AWHOST -M=W')
  534.       BAT('BATEXIT')
  535.    else
  536. ;      BAT('CD\PUBLIC\BITFAX')
  537. ;      BAT('MARXMENU SFAX')
  538.       BAT('BATEXIT')
  539.    endif
  540. endif
  541.  
  542. comment
  543. =======
  544. if UserName = 'LITE'
  545.    Capture('DOT',1)
  546.    NovMapRoot('W','P:\BITFAX')
  547.    Bat(LoadHigh + 'BITSCHED')
  548.    Bat(LoadHigh + 'RECVFAX')
  549.    if AfterHours
  550.       BAT('CD\PUBLIC\AWHOST')
  551.       BAT('AWHOST -M=W')
  552.       BAT('BATEXIT')
  553.    else
  554.       BAT('CD\PUBLIC\BITFAX')
  555.       BAT('MARXMENU SFAX')
  556.       BAT('BATEXIT')
  557.    endif
  558. endif
  559. =======
  560. EndComment
  561.  
  562. Comment
  563. ================================================================
  564.  
  565. The batch file ends by jumping to personal menu, if there is one, or
  566. the default menu if there isn't. DROPTO.BAT is used to erase the
  567. temporary batch file that this menu creates.
  568.  
  569. ================================================================
  570. EndComment
  571.  
  572. if DrDos6
  573.    Bat ('DROPTO MARXMENU NOVMAX')
  574. endif
  575.  
  576. if ExistFile ('F:\HOME\' + UserName + '\' + UserName + '.MNU')
  577.    Bat ('DROPTO MARX ' + UserName)
  578. endif
  579.  
  580. Bat ('DROPTO MARX TYME')
  581.  
  582. ExitMenu
  583.  
  584. ;===============================================================
  585. ;===============================================================
  586.  
  587. ;----- Procedure Definitions
  588.  
  589. Procedure Capture (Queue, PrinterPort)
  590.    NovCaptureQueue(PrinterPort) = Queue
  591.    NovCaptureTimeOut(PrinterPort) = 5     ;5 second timeout
  592. EndProc
  593.  
  594.  
  595. Procedure LoadHigh
  596.    if ReadEnv('OS2') = 'Y'
  597.       Return 'LOADHIGH '
  598.    else
  599.       Return 'P:\QEMM\LOADHI.COM '
  600.    endif
  601. EndProc
  602.  
  603.  
  604. Comment
  605. ========================================================
  606.  
  607. If Environment variables USERNAME and PASSWORD are set, this menu
  608. will attempt to log into the network using these values. This allows
  609. for automatic login. You can also pass the parameters on the command
  610. line as follows.
  611.  
  612. MarxMenu Login <Name> <Password>
  613.  
  614. The name may contain a referrence to a server: Server/Name
  615.  
  616. ========================================================
  617. EndComment
  618.  
  619. ;----- Try Automatic Login using Environment Variables
  620.  
  621. Procedure TryAutoLogin
  622.    if Logged then Return
  623.    if CapsLock
  624.       CapsLock Off
  625.    else
  626.       UserName = ParamStr(2)
  627.       if UserName = '' then UserName = ReadEnv('USERNAME')
  628.       if UserName > ''
  629.          OldPass = ParamStr(3)
  630.          if OldPass = '' then OldPass = ReadEnv('PASSWORD')
  631.          if OldPass > ''
  632.             SkipError = True
  633.             Login (UserName,OldPass)
  634.             SkipError = False
  635.             if PasswordNeedsChanged
  636.                Logged = False
  637.                Suggest 'C'
  638.             endif
  639.          endif
  640.       endif
  641.    endif
  642. EndProc
  643.  
  644. ;----- Select colors and prepare screen
  645.  
  646. Procedure LoginFromScreen
  647.    if ColorScreen
  648.       TextColor White Red
  649.       BoxBorderColor Green Brown
  650.       BoxInsideColor Black Brown
  651.       ClearScreen 176
  652.       ClockColor Black Brown
  653.       TextColor Black Green
  654.       BoxHeaderColor Yellow Mag
  655.       Shadow
  656.    else
  657.       TextColor Grey Black
  658.       ClearScreen 176
  659.       TextColor Black Grey
  660.       BoxBorderColor Black Grey
  661.       BoxInsideColor Black Grey
  662.       BoxHeaderColor Black Grey
  663.       ClockColor Black Grey
  664.    endif
  665.    BlankMessage = 'Netware Login'
  666.    ClockMode = 262
  667.    GotoXY 1 25
  668.    ClearLine
  669.    WriteCenter "Computer Tyme Master Network Login Menu"
  670.    SingleLineBox
  671.    Explode Off
  672.    ShadowColor Grey Red
  673.    if ColorScreen
  674.       DrawBox 3 2 74 5
  675.       ClockPos 42 5
  676.       TextColor Blue Brown
  677.    else
  678.       DrawBox 3 2 76 5
  679.       ClockPos 44 5
  680.    endif
  681.    WriteCenter 'Computer Tyme Software Development Laboratory'
  682.    Writeln
  683.    TextColor Black Brown
  684.    WriteCenter '───────────────────────────────────────────────────────'
  685.    Writeln
  686.    TextColor Black Brown
  687.    Write "  (C) 1990-92 by Marc Perkel"
  688.    DoubleLineBox
  689.    BlankTime = 10
  690.  
  691.    Explode On
  692.    BlockBox
  693.    BoxBorderColor Green Blue
  694.    BoxInsideColor Yellow Blue
  695.    BoxHeader = " Station Information "
  696.    if ColorScreen
  697.       DrawBox 39 17 38 6
  698.       TextColor Yellow Blue
  699.    else
  700.       DrawBox 41 17 38 6
  701.       TextColor Grey Black
  702.    endif
  703.    StatusWin = CurrentWindow
  704.    UpdateStatusWindow
  705.  
  706.    ChooseOption
  707.  
  708.    EraseTopWindow
  709.    EraseTopWindow
  710.    EraseTopWindow
  711.    TextColor Grey Black
  712.    ClearScreen
  713. EndProc
  714.  
  715.  
  716. Procedure ChooseOption
  717. var Ch X
  718.    repeat
  719.       X = 4
  720.       if NumberOfElements(Servers) > 1 then X = 5
  721.       DrawBox 3 17 26 X
  722.       UseArrows
  723.       OnScreenOnly
  724.       InverseColor Yellow Cyan
  725.       Writeln '  L - Login to Network'
  726.       Write   '  C - Change Password'
  727.       if NumberOfElements(Servers) > 1
  728.          Writeln
  729.          Write   '  S - Select Server'
  730.       endif
  731.       Ch = UpperCase(ReadKey)
  732.       if (Ch = 'L') or (Ch = 'C') or (Ch = 'S')
  733.          EraseTopWindow
  734.          if Ch = 'L'
  735.             LoginToNetwork (False)
  736.          endif
  737.          if Ch = 'C'
  738.             LoginToNetwork (True)
  739.          endif
  740.          if Ch = 'S'
  741.             SelectServer
  742.          endif
  743.       endif
  744.    until Logged
  745. EndProc
  746.  
  747.  
  748. Procedure Warning (St)
  749.    BoxHeader ' Warning '
  750.    DrawBox 3 17 length(St) + 4 3
  751.    Write Char(7) ' ' St
  752.    Wait 300
  753.    EraseTopWindow
  754. EndProc
  755.  
  756.  
  757. Procedure LoginToNetwork (CP)
  758. var NewPassVerify
  759.    BoxHeader = ' Logging into Server * ' + MyServer + ' '
  760.    DrawBox 3 10 50 4
  761.    UseArrows Off
  762.    Security
  763.    repeat
  764.       if UserName = ''
  765.          Write ' Name: '
  766.          UserName = UpperCase(Readln)
  767.          Writeln
  768.       endif
  769.       Write ' Password: '
  770.       OldPass = UpperCase(Readln)
  771.       Write CR
  772.       ClearLine
  773.       Login (UserName,OldPass)
  774.       if not CP
  775.          CP = PasswordNeedsChanged
  776.          if CP then Warning('Time to change your password!')
  777.       endif
  778.       if CP
  779.          if LastKey <> Esc
  780.             repeat
  781.                Write ' New Password: '
  782.                NewPass = UpperCase(Readln)
  783.                Write CR
  784.                ClearLine
  785.                if NewPass = OldPass then Warning('Select a NEW Password!')
  786.             until NewPass <> OldPass
  787.          endif
  788.          if LastKey <> Esc
  789.             Write ' Verify: '
  790.             NewPassVerify = UpperCase(Readln)
  791.             Write CR
  792.             ClearLine
  793.             if NewPass = NewPassVerify
  794.                NovChangePassword (OldPass,NewPass)
  795.                if NovResult <> 0
  796.                   Warning ('Password Change Failed!')
  797.                   Logged = False
  798.                endif
  799.             else
  800.                Warning('Password Typed Wrong!')
  801.                Logged = False
  802.             endif
  803.          endif
  804.       endif
  805.    ClearScreen
  806.    if not Logged
  807.       UserName = ''
  808.    endif
  809.    until (LastKey = Esc) or Logged
  810.    EraseTopWindow
  811. EndProc
  812.  
  813.  
  814. Procedure Login (User, Pass)
  815.    if UseMarxLogin
  816.       NovLogin (MyServer + '/' + User, Pass)
  817.       if NovResult = 223 then NovResult = 0  ;grace login
  818.       Logged = NovResult = 0
  819.       if Logged
  820.          NovMapDrive('F',MyServer + '/SYS:LOGIN')
  821.       endif
  822.    else
  823.       ClearScreenFirst Off
  824.       UseCommand On
  825.       StuffKbd = Pass + CR
  826.       Execute ('LOGIN.EXE ' + MyServer + '/' + User + '>nul')
  827.       Logged = ExistDir ('F:\SYSTEM')
  828.    endif
  829.    if not Logged and not SkipError
  830.  
  831.       if NovResult = 254
  832.          Warning('All Logins Disabled!')
  833.  
  834.       elseif NovResult = 222
  835.          Warning('Password Expired!')
  836.  
  837.       elseif NovResult = 252
  838.          Warning('Invalid User Name!')
  839.  
  840.       elseif NovResult = 220
  841.          Warning('Account Disabled!')
  842.  
  843.       elseif (NovResult = 218) or (NovResult = 219)
  844.          Warning('Invalid Login Time!')
  845.  
  846.       elseif NovResult = 197
  847.          Warning('Intruder Lockout!')
  848.  
  849.       elseif NovResult = 255
  850.          Warning('Bad Password!')
  851.  
  852.       else
  853.          Warning('Login Failed! '+ Str(NovResult))
  854.  
  855.       endif
  856.  
  857.    endif
  858. EndProc
  859.  
  860.  
  861. Procedure PasswordNeedsChanged
  862. var X
  863.    X = NovPasswordExpDate (UserName)
  864.    if X = 0 then Return False
  865.    Return (X - Today) / SecondsInDay <= 5
  866. EndProc
  867.  
  868.  
  869. Procedure SelectServer
  870.    DrawBox 25 9 20 NumberOfElements (Servers) + 2
  871.    MyServer = PickOne (Servers)
  872.    NovSetPrimaryServer (MyServer)
  873.    NovSetPreferredServer (MyServer)
  874.    EraseTopWindow
  875.    UpdateStatusWindow
  876. EndProc
  877.  
  878.  
  879. Procedure UpdateStatusWindow
  880.    SetTopWindow StatusWin
  881.    ClearScreen
  882.    NetAddress = NovStationAddress (NovConnection)
  883.    Station = Str(NovConnection)
  884.    while length(Station) < 3
  885.       Station = '0' + Station
  886.    endwhile
  887.    Writeln '           Server: ' MyServer
  888.    Writeln '          Network: ' NetAddress
  889.    Writeln '       Connection: ' Station
  890.    Write   '      DOS Version: ' DosVersionString
  891.    if StatusWin <> CurrentWindow
  892.       SetWindowUnder (StatusWin,StatusWin + 1)
  893.    endif
  894. EndProc
  895.  
  896. ;----- Returns True if in list
  897.  
  898. Procedure InGroup (Group)
  899.    Return PosInSortedList(UpperCase(Group),MyGroups) > 0
  900. EndProc
  901.  
  902. ;----- Return True if after hours
  903.  
  904. Procedure AfterHours
  905.    Return (DayOfWeek = Sun) or (DayOfWeek = Sat) or (Hour > 17) or (Hour < 7)
  906. EndProc
  907.  
  908. ;----- Show Item for Debugging
  909.  
  910. Procedure ShowMe (Item)
  911.    DrawBox 1 23 80 3
  912.    Write ' '
  913.    TextColor Yellow Cyan
  914.    Write Item
  915.    Wait 300
  916.    EraseTopWindow
  917. EndProc
  918.  
  919.